﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace BridgeShips
{
    public class WeathersDate : UDPDateBase
    {
        private string m_oldStar = "";
        private List<string> m_weatherList = new List<string>();
        public override void GetDictionaryDate(string date)
        {
            base.GetDictionaryDate(date);
            if (m_oldStar!=date)
            {
                m_oldStar = date;
                m_weatherList.Clear();
                m_weatherList = SpitReceivedMsgs.SpitMsgs(date);

               // ShipsDictionary.Instance.InitDateAddInDic("temperature", m_weatherList[1]);
                if (m_weatherList[1] == "#")
                {
                    m_weatherList[1] = "25";
                }
                TempUIPanel._instance.SetTemperatureUI(float.Parse(m_weatherList[1]));
                //平均风速
               // ShipsDictionary.Instance.InitDateAddInDic("averageWindSpeed", m_weatherList[2]);
                if (m_weatherList[2] == "#")
                {
                    m_weatherList[2] = "1";
                }
                TempUIPanel._instance.SetAverageWind(float.Parse(m_weatherList[2]));
                //最大风速
               // ShipsDictionary.Instance.InitDateAddInDic("maxWindSpeed", m_weatherList[3]);
                if (m_weatherList[3] == "#")
                {
                    m_weatherList[3] = "1";
                }
                TempUIPanel._instance.SetMaxWind(float.Parse(m_weatherList[3]));
                //风向
               // ShipsDictionary.Instance.InitDateAddInDic("windDirection", m_weatherList[4]);
                if (m_weatherList[4] == "#")
                {
                    m_weatherList[4] = "无";
                }
                TempUIPanel._instance.SetWindDir(m_weatherList[4]);
                //湿度
              //  ShipsDictionary.Instance.InitDateAddInDic("humidity", m_weatherList[5]);
                if (m_weatherList[5] == "#")
                {
                    m_weatherList[5] = "30";
                }
                TempUIPanel._instance.SetHumidityUI(float.Parse(m_weatherList[5]));
                //气压值
               // ShipsDictionary.Instance.InitDateAddInDic("airPressure", m_weatherList[6]);
                if (m_weatherList[6] == "#")
                {
                    m_weatherList[6] = "102";
                }
                TempUIPanel._instance.SetAirPressureUI(float.Parse(m_weatherList[6]));
            }
        }
    }
}
